package main

import (
	"fmt"
	"net"
	"sync"
	"time"
)

func main() {
	var wg sync.WaitGroup
	for i := 0; i < 255; i++ {
		wg.Add(1)
		go func(i int) {
			defer wg.Done()
			ip := fmt.Sprintf("192.168.5.6:%d", i)
			_, err := net.DialTimeout("tcp", ip, 20*time.Millisecond)
			if err != nil {
				return
			}
			fmt.Println(ip)
		}(i)
	}
	wg.Wait()
}
